<template>
	<view>
		<u-navbar title="我的钱包" :autoBack="true" bgColor="transparent" leftIconColor='#fff'
			titleStyle='color:#fff;'>
		</u-navbar>
		<view class="top">
			<view class="topbox">
				<image class="topbgpic" src="./static/topbg.png" mode="widthFix"></image>
				<view class="" style="position: absolute;top: 0;display: flex;flex-direction: column;justify-content: space-between;height: calc(100% - 100rpx);padding: 50rpx 0;">
					<view class="toptitle flex">
						我的余额（元）
						<image style="width: 47rpx;height: 8rpx;" src="./static/shenglve.png" mode=""></image>
					</view>
					<view class="num">
						{{userinfo.money}}
					</view>
					<view class="flex" @click="go('/pages/wallet/recharge')" style="padding-left: 50rpx;font-size: 30rpx;color: #333;">
						充值余额
						<image style="width: 13rpx;height: 18rpx;margin-left: 9rpx;" src="./static/jiantou.png" mode="">
						</image>
					</view>
					<view class="flex" @click="go('/pages/wallet/withdrawal')" style="padding-left: 50rpx;font-size: 30rpx;color: #333;margin-top: 20rpx;">
						提现余额
						<image style="width: 13rpx;height: 18rpx;margin-left: 9rpx;" src="./static/jiantou.png" mode="">
						</image>
					</view>
				</view>
			</view>
		</view>
		<view class="title">
			我的账单
		</view>
		<scroll-view scroll-y="true" class="scroll-view">
			<view class="friendlist">
				<view class="frienditem flex" v-for="(item,index) in friendlist" :key="index">
					<image class="avatar" src="./static/qian.png" mode=""></image>
					<view class="right flex">
						<view class="rl">
							<view class="name">
								{{item.memo}}
							</view>
							<view class="time">
								<!-- jointime -->
								{{$u.timeFormat(item.createtime, 'yyyy-mm-dd hh:MM')}}
								<!-- {{item.time}} -->
							</view>
						</view>
						<view class="rr flex">
							<image class="jian_icon" src="./static/jian.png" mode="" v-if=""></image>
							{{Number(item.money).toFixed(2)}}
						</view>
					</view>
				</view>
				<u-loadmore :status="status" @loadmore="onre"/>
			</view>
			
		</scroll-view>
	</view>
</template>

<script>
	import {ourMoneyLog} from '@/api/my.js'
	export default {
		data() {
			return {
				userinfo:{},
				friendlist: [],
				status: 'loadmore',
				page: 1,
				last_page:0
			};
		},
		methods:{
			go(url){
				uni.navigateTo({
					url
				})
			},
			getlist(){
				ourMoneyLog({page:this.page}).then(res=>{
					this.status='loadmore'
					this.last_page=res.data.data.last_page
					this.friendlist=[...this.friendlist,...res.data.data.data]
					// this.friendlist=res.data.data.data
				})
			},
			onre(){
				this.page++
				if(this.page<=this.last_page){
					this.getlist()
				}else{
					this.status='nomore'
				}
			}
		},
		onLoad() {
			this.userinfo=uni.getStorageSync('userinfo')
			this.getlist()
		},
		onReachBottom() {
			this.onre()
		},
		
	}
</script>

<style lang="less">
	.top {
		width: 750rpx;
		height: 334rpx;
		background-color: #ff750d;
		position: relative;

		.topbox {
			width: 690rpx;
			position: absolute;
			bottom: calc(-50% + 30rpx);
			left: 30rpx;

			.topbgpic {
				width: 100%;
				border-radius: 30rpx;
			}

			.toptitle {
				display: flex;
				padding-left: 50rpx;
				color: #999999;
				font-size: 32rpx;
				align-items: center;
				justify-content: space-between;
				width: 590rpx;
			}

			.num {
				padding-left: 50rpx;
				font-size: 48rpx;
				font-family: PangMenZhengDao;
			}
		}
	}
	.title{
		margin-top: 169rpx;
		font-size: 34rpx;
		padding-left: 28rpx;
		color: #3F3F3F;
		font-weight: bold;
		line-height: 40rpx;
	}
	.friendlist {
		padding: 0 0 50rpx 32rpx;
		
		.frienditem {
			align-items: flex-end;
			padding-top: 28rpx;
			border-bottom: 1rpx solid #DCDCDC;
		}
	
		.avatar {
			margin-right: 11rpx;
			width: 78rpx;
			height: 78rpx;
			border-radius: 50%;
			align-self: flex-start;
		}
	
		.right {
			flex: 1;
			justify-content: space-between;
			padding-bottom: 30rpx;
			height: 90rpx;
	
			.rl {
				height: 78rpx;
				display: flex;
				flex-direction: column;
				justify-content: space-between;
				.name {
					font-size: 32rpx;
					color: #333333;
					// font-weight: bold;
				}
	
				.time {
					font-size: 24rpx;
					color: #7A7878;
				}
			}
	
			.rr {
				color: #333333;
				font-size: 33rpx;
				font-weight: bold;
				padding-right: 33rpx;
				line-height: 25rpx;
				
				.jf_icon {
					width: 16rpx;
					height: 15rpx;
					// margin-right: 10rpx;
					align-self: flex-end;
				}
				.jian_icon{
					width: 15rpx;
					height: 5rpx;
					// margin-right: 10rpx;
					align-self: center;
				}
			}
		}
	}
	.flex{
		display: flex;
		align-items: center;
	}
	.scroll-view{
		height: calc(100vh - 334rpx - 169rpx - 40rpx);
	}
</style>
